package com.service.bean;

import java.util.Date;

import com.service.cache.CacheManager;

public class JobFlow {

	public JobFlow(String gpsno, String typeno) {
		this.gpsno = gpsno;
		this.typeno = typeno;
	}
	public String gpsno;
	public String typeno;
	public Integer Size;
	public JobFlow nextJob;	
	public Date StartTime;
	
	//找到尾巴
	public static JobFlow tailJob(JobFlow jobFlow){
		if(jobFlow.nextJob != null){
			return tailJob(jobFlow.nextJob);
		}else{
			return jobFlow;
		}		
	}
	
	//轮到下一个了
	public static JobFlow nextJob(JobFlow headjobFlow){
		if(headjobFlow.nextJob != null){
			//覆盖头节点
			CacheManager.instance().jobFlowMap.put(headjobFlow.gpsno,headjobFlow.nextJob);
			return headjobFlow.nextJob;
		}else{
			CacheManager.instance().jobFlowMap.remove(headjobFlow.gpsno);
			return null;
		}
	}

}
